import React from "react";
import PropTypes from "prop-types";

/**
 *  Header Component
 */
export default class Header extends React.Component
{
    /**
     * 组件类名
     */
    className = "header";

    /**
     * 默认属性
     */
    static defaultProps =
    {
        class : "",
        style : {},
        children : []
    };

    /**
     * 属性类型
     */
    static propTypes =
    {
        class : PropTypes.string,
        style : PropTypes.object,
        children : PropTypes.oneOfType([PropTypes.object, PropTypes.array])
    };

    /**
     * 组件将要挂载
     */
    componentWillMount()
    {
        if (this.props.class) {
            this.className += " " + this.props.class;
        }
    }

    render ()
    {
        return <div className={this.className}>
            {this.props.children}
        </div>
    }
}